local function main(userOb,msgData)
    if not msgData.pops then
        return
    end

    local id = userOb:use_trump(msgData.pops)
    if not id then
        local result = {}
        result.code = 400
        userOb:send_packet("MSGS2CKillTrump", result)
        return
    end

    if id == 20003 then
        local weapon = INVENTORY_D:get_best_weapon(userOb)
        if not weapon then
            local result = {}
            result.code = 401
            userOb:send_packet("MSGS2CKillTrump", result)
            return
        end

        local item = ITEM_D:find_item(weapon.propId + 1)
        if not weapon then
            local result = {}
            result.code = 402
            userOb:send_packet("MSGS2CKillTrump", result)
            return
        end

        local rank = weapon.rank

        ---! 武器升级
        weapon.propId = item.propId

        ---! 更新玩家等级
        userOb:set_level(weapon.lev)

        ---! 货币升阶
        if weapon.rank > rank then
            --! 更新玩家阶级
            userOb:set_rank(weapon.rank)
        end

        ---! 奖励钻石
        userOb:add_currency(GamePropIds.kGamePropIdsDiamondsIcon, weapon.firstAward)
        ITEM_D:send_currency_info(userOb)

        ---! 同步关卡排名
        RANK_D:sync_rank_data(userOb)
    end

    local result = {}
    result.code = 200
    result.data = userOb:query_trump()
    result.killid = id
    userOb:send_packet("MSGS2CKillTrump", result)
    ITEM_D:send_props_info(userOb)
end

--注册方法
COMMAND_D:register_command("MSGC2SKillTrump",GameCmdType.NONE, main)
